package com.github.admin.edu.security.jwt.server.service.impl;

import com.github.admin.edu.assembly.common.entity.JsonEntity;
import com.github.admin.edu.assembly.common.util.JsonUtils;
import com.github.admin.edu.assembly.string.util.StringUtils;
import com.github.admin.edu.oauth.server.api.entity.TSequence;
import com.github.admin.edu.orm.serivce.TSequenceService;
import com.github.admin.edu.security.jwt.server.service.SequenceManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Create by IntelliJ IDEA
 * 用户：王建
 * 日期：2018-8-3
 */
@Service
public class SequenceManagerServiceImpl implements SequenceManagerService {

    @Autowired
    private TSequenceService sequenceService;

    @Override
    public String getObjectId(String obj) {
        if(StringUtils.isNotBlank(obj)){
            TSequence sequence=new TSequence();
            sequence.setId(sequenceService.getUserId(obj));
            JsonEntity<TSequence> jsonEntity=new JsonEntity<>();
            jsonEntity.setData(sequence);
            return JsonUtils.toJson(jsonEntity);
        }
        return null;
    }
}
